#pragma once

#include "IWindow.h"
#include "Formtypes.h"

delegate Delegate<bool(IObject* /*form*/,showAction /*action*/,bool /*modal*/)> ShowEventHandler;
delegate Delegate<void(IObject* /*form*/)> CloseEventHandler;
delegate Delegate<void(IObject* /*form*/,Packet& /*packet*/)> PacketExchangeEventHandler;

interface IForm : public IWindow
{
	DEFINE_IID(IID_Form)

	//for data exchange
	virtual void ExchangePacket(Packet& packet) = 0;

	//for modal-less form
	virtual bool Show(showAction action) = 0;
	virtual void Close() = 0;

	//for modal form
	virtual bool ShowModal() = 0;
	virtual bool ShowModalLoop(Packet& packet) = 0;

	/*for inner usage*/
	virtual void Setwindow(uintptr window) = 0;
	virtual uintptr Getwindow() const = 0;

	event_declare(CloseEventHandler,Closed);
	event_declare(ShowEventHandler,Showed);
	event_declare(PacketExchangeEventHandler,PacketExchanged);
};

